package com.zj.classwork;
import java.util.Scanner;
public class ClassWork18 {
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        System.out.println("*********************");
        System.out.println("请选择购买的商品编号：");
        System.out.println("1.T恤  2.网球鞋  3.网球拍");
        System.out.println("*********************");
        int count=0;
        double sum=0;
        while (count<3)
        {
            System.out.println("请输入商品编号：");
            int thing= input.nextInt();
            System.out.println("请输入购买数量：");
            int number=input.nextInt();

            switch (thing)
            {

                case 1:
                    sum+=number*245.0;
                    System.out.println("T恤￥245.0   数量"+number+"   合计￥"+sum);
                    break;
                case 2:
                    sum+=number*245.0;
                    System.out.println("网球鞋￥145.0   数量"+number+"   合计￥"+sum);
                    break;
                case 3:
                    sum+=number*245.0;
                    System.out.println("网球拍￥225.0   数量"+number+"   合计￥"+sum);
                    break;
            }
            System.out.println("是否继续（y/n）");
            String value= input.next();
            if("y".equals(value))
            {
                count++;
                continue;
            }
            else {
                if(sum>3000)
                {
                    System.out.println("折扣：0.6");
                    System.out.println("应付金额："+sum*0.6);
                    System.out.println("实付金额：");
                    double amount= input.nextDouble();
                    System.out.println("找钱:"+(amount-sum*0.6));

                }
                else if(sum>2000&&sum<3000){

                    System.out.println("折扣：0.7");
                    System.out.println("应付金额："+sum*0.7);
                    System.out.println("实付金额：");
                    double amount= input.nextDouble();
                    System.out.println("找钱:"+(amount-sum*0.7));
                }
                else if(sum>1000&&sum<2000){

                    System.out.println("折扣：0.8");
                    System.out.println("应付金额："+sum*0.8);
                    System.out.println("实付金额：");
                    double amount= input.nextDouble();
                    System.out.println("找钱:"+(amount-sum*0.8));
                }
                else if(sum>500&&sum<1000){

                    System.out.println("折扣：0.9");
                    System.out.println("应付金额："+sum*0.9);
                    System.out.println("实付金额：");
                    double amount= input.nextDouble();
                    System.out.println("找钱:"+(amount-sum*0.9));
                }
                else{
                    System.out.println("应付金额："+sum);
                    System.out.println("实付金额：");
                    double amount= input.nextDouble();
                    System.out.println("找钱:"+(amount-sum));
                }
                break;
            }
        }








    }

}
